package com.opennews.openplatform.controller;

import com.opennews.openplatform.myspringbootcore.dto.ApiResponse;
import com.opennews.openplatform.myspringbootmvccore.helper.HttpResponseHelper;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * This is used by upload package.
 * We need to check and refresh the token if it can.
 * Remember to set this url as isFullyAuthenticated() in spring security rest.
 * We are making a http get request to this url before upload.
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/token-check")
public class TokenCheckController {
    private final HttpResponseHelper httpResponseHelper;

    @GetMapping
    public ResponseEntity<ApiResponse<Object>> index() {
        return httpResponseHelper.getSuccessResponse();
    }
}
